<html>
<head>
    @include('v1.common.meta')
    <link rel="stylesheet" href="{{elixir('css/basicdata.css')}}">
</head>
<body>
<div class="yjs-grid">
    <div class="yjs-grid-box">
        <div class="layui-tab">
            @if(Auth::check())
                <div class="layui-container">
                    @if($view==='addData')
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>新增迎新换届</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：新增数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane" name="newArrivalForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="enrollment_year" value="">
                                            <input type="hidden" name="enrollment_term" value="">
                                            <input type="hidden" name="enrollment_serial" value="">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>招生年份</label>
                                                        <div class="layui-input-inline">
                                                            <select id="enrollment_year" name="enrollment_year"
                                                                    lay-filter="enrollment_year" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($years as $year)
                                                                    <option value={{$year}}>{{$year}}</option>
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>招生学期</label>
                                                        <div class="layui-input-inline">
                                                            <select id="enrollment_term" name="enrollment_term"
                                                                    lay-filter="enrollment_term" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($terms as $term)
                                                                    <option value={{$term['code']}}>{{$term['name']}}</option>
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>招生序号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" id="enrollment_serial" name="enrollment_serial"
                                                                   lay-filter="enrollment_serial"
                                                                   lay-verify="required"
                                                                   placeholder="请输入招生序号"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label"><i
                                                                    class="layui-icon">&#xe605;</i>迎新代码</label>
                                                        <div class="layui-input-inline">
                                                            <input id="newArrivalCode" type="text" name="code" disabled
                                                                   lay-filter="newArrivalCode"
                                                                   lay-verify="required|code"
                                                                   class="layui-input">
                                                        </div>

                                                        <a class="layui-btn  layui-btn-warm"
                                                           data-type="createNewArrivalCode">
                                                            生成
                                                        </a>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <div class="layui-row">
                                                <div class="layui-form-item" pane="">
                                                    <label class="layui-form-label">复用信息</label>
                                                    <div class="layui-input-block">
                                                        @foreach($processes as $process)
                                                            <input type="checkbox"  name={{$process['code']}} lay-skin="primary" checked title={{$process['name']}} >
                                                        @endforeach
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">验证码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="captcha" maxlength="4"
                                                                   lay-verify="required"
                                                                   placeholder="请输入图片验证码" autocomplete="off"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    <div class="layui-form-item">
                                                        <img class="getLVcode" src="{{ captcha_src('mini') }}"
                                                             width="70px"
                                                             height="34px" style="border: 1px solid green;"/>
                                                        <div class="layui-form-mid layui-word-aux">
                                                            点击图片刷新验证码
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>

                    @elseif($view==='viewData')
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>查看【{{$itemData['code']}}】迎新换届信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：查看数据时，所有表单项均不可修改。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane" name="edit_form">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">迎新代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['code']}}"
                                                                    id="edit_code" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" >招生年份</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['enrollment_year']}}"
                                                                   id="edit_enrollment_year" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">招生学期</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['enrollment_term']}}"
                                                                   id="edit_enrollment_term" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">招生序号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['enrollment_serial']}}"
                                                                   id="edit_enrollment_serial" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">当前启动</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['isOn']}}"
                                                                   id="edit_isOn" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">创建时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['created_at']}}"
                                                                   id="edit_created_at" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">更新时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['updated_at']}}"
                                                                   id="edit_updated_at" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>


                    @else
                        {{--视图类型不正确--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <blockquote class="layui-elem-quote-error">
                                    友情提示：视图类型不正确，无法支持后续操作。
                                </blockquote>
                            </div>
                        </div>
                    @endif
                </div>
            @else
                <div class="layui-container">
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <blockquote class="layui-elem-quote-error">
                                友情提示：该功能只面向已成功登录系统，并具有相应权限的用户可用。
                            </blockquote>
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

@include('v1.common.js')
<script src="{{elixir('js/newArrivalItem.js')}}"></script>
</body>
<script type="text/html">
    <input type="hidden" id="rspStatus" value="">
    <input type="hidden" id="rspMsg" value="">
</script>
<style>
    .layui-form-checkbox span{padding:0 10px;height:5%;font-size:14px;background-color:#d2d2d2;color:#fff;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
</style>
</html>